#{extends 'main.html' /}
#{set title:'Iction Home' /}
#{set 'moreScripts'}
<!--导入kindeditor(富文本编辑器)相关文件-->
#{script src='kindeditor/kindeditor.js'/}
#{script src='kindeditor/lang/zh_CN.js'/}
<!--导入layer(web弹窗/层)相关文件-->
#{script src='layer/layer.min.js'/}

<!--初始化kindeditor-->
<script>
$(document).ready(function(){
	var editor;
	var options = {
		width : '506px',
		minWidth: 506,
		uploadJson : '@{Ajax.addArticleImg}',
		fileManagerJson : '@{Ajax.addArticleManager}',
		allowFileManager : true,
		autoHeightMode : true,
		afterCreate : function() {this.loadPlugin('autoheight');},
		resizeType : 1,
		allowPreviewEmoticons : false,
		items : [
				'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'image', 'link', 'unlink', 'table', '|', 'about']
	};
	KindEditor.ready(function(K) {
		editor = K.create('#editor_acticle',options);
	});
});
<!--保存kindeditor内容并上传-->
function syncHtml(){
	editor.sync();
}
</script>

<!--Edit-layer init-->
<script>
$(document).ready(function(){
	$(".edit").click(function(){
		var va = $(this).parent().parent().children().eq(0).children().eq(1).val();
		$.layer({
		    type: 2,
		    shade: [0],
		    fix: false,
		    title: 'Article Edit',
		    maxmin: true,
		    iframe: {src : 'edit?id=' + va},
		    area: ['800px' , '440px'],
		    close: function(index){}
		}); 
	});
});
</script>

<!--Ajax js-->
<script>
function editPost(art_id){
	$.post("@{ArticleAdmin.edit}",{id:art_id});
}
</script>

<!--Page CSS And Other JQuery-->
<script>
$(document).ready(function(){
	$(".submenu > ul > li > a").eq(2).addClass("selected");
	
	$(".detele").click(function(){
		var va = $(this).parent().parent().children().eq(0).children().eq(1).val();
		layer.confirm();
	});
});
</script>
#{/set}

<div id="right_wrap">
	<div id="right_content">             
		<h2>User Tables section</h2> 
		<table id="rounded-corner">
		    <thead>
		    	<tr>
		    		<th></th>
		        	<th>createDate</th>
		        	<th>User</th>
		            <th>Title</th>
		            <th>introduce</th>
		            <th>Edit</th>
		            <th>Delete</th>
		        </tr>
		    </thead>
		    <tfoot>
		    	<tr>
		        	<td colspan="12">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut.</td>
		        </tr>
		    </tfoot>
		    <tbody>
		    </tbody>
		</table>
		
		<div class="form_sub_buttons">
		<a href="#" class="button green">Edit selected</a>
	    <a href="#" class="button red">Delete selected</a>
	    </div>
	    
	    #{form @Form.addArticle(), onSubmit:'return syncHtml()'}
	    <ul id="tabsmenu" class="tabsmenu">
	        <li class="active"><a href="#tab1">Article</a></li>
	    </ul>
	    <div id="tab1" class="tabcontent">
	        <h3>Article Commit</h3>
	        <div class="form">
	            <div class="form_row">
		            <label>Title:</label>
		            <input type="text" class="form_input" name="article.title" />
		            <span class="error">#{error 'article.title'/}</span>
	            </div>
	            <div class="form_row">
		            <label>Introduce:</label>
		            <input type="text" class="form_input" name="article.introduce" />
		            <span class="error">#{error 'article.introduce'/}</span>
	            </div>
	            <div class="form_row">
		            <label>Content:</label>
		            <textarea class="form_textarea" name="article.content" id="editor_acticle"></textarea>
		            <span class="error">#{error 'article.content'/}</span>
	            </div>
	            <div class="form_row">
	            	<input type="submit" class="form_submit" value="Submit" />
	            </div> 
	            <div class="clear"></div>
	        </div>
	    </div>
		#{/form}
	</div>	<!--end -->
</div><!-- end of right content-->